﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SetTag : MonoBehaviour
{
    [Header("目的地展示")]
    public Text txtTag;

    [Header("导航线")]
    public GameObject navigationLine;
    [Header("导航箭头")]
    public GameObject navigationJt;
    public CArrowLockAt cArrowLockAt;

    [Header("水果")]
    public GameObject sg;
    [Header("电脑")]
    public GameObject dn;
    [Header("手机")]
    public GameObject sj;
    [Header("青菜")]
    public GameObject qc;
    [Header("零食")]
    public GameObject ls;

    public CreatNvPath creatNvPath;

    // Start is called before the first frame update
    void Start()
    {
        baok = creatNvPath.isOK;
        navigationLine.SetActive(false);
        navigationJt.SetActive(false);
    }

    bool baok = false;

    // Update is called once per frame
    void Update()
    {
        if (baok != creatNvPath.isOK)
        {
            baok = creatNvPath.isOK;
            if (creatNvPath.isOK)
            {
                txtTag.text = "已到达目的地！";
            }
            else
            {
                txtTag.text = "请选择目的地：";
            }
        }
    }

    public void SetTagIndex(int t)
    {
        navigationLine.SetActive(true);
        navigationJt.SetActive(true);
        switch (t)
        {
            case 1://水果
                txtTag.text = "目的地：水果";
                creatNvPath.TagLocal = sg.transform.position;
                cArrowLockAt.target = sg.transform;
                break;
            case 2://电脑
                txtTag.text = "目的地：电脑";
                creatNvPath.TagLocal = dn.transform.position;
                cArrowLockAt.target = dn.transform;
                break;
            case 3://青菜
                txtTag.text = "目的地：青菜";
                creatNvPath.TagLocal = qc.transform.position;
                cArrowLockAt.target = qc.transform;
                break;
            case 4://零食
                txtTag.text = "目的地：零食";
                creatNvPath.TagLocal = ls.transform.position;
                cArrowLockAt.target = ls.transform;
                break;
            case 5://手机
                txtTag.text = "目的地：手机";
                creatNvPath.TagLocal = sj.transform.position;
                cArrowLockAt.target = sj.transform;
                break;
        }
    }
}
